/*
  遍历数组打印出最值
 */

import java.util.Scanner;

public class MothodDemo05 {
    public static void main(String[] args) {
        //建立输入
        Scanner sc = new Scanner(System.in);
        int arr[] = new int[6];
        for (int i = 0; i < 6; i++) {
            System.out.println("请输入第" + (i + 1) + "个数字:");
            arr[i] = sc.nextInt();
        }
        System.out.println("最大值是:" + max(arr));
        System.out.println("最大值是:" + min(arr));
    }

    public static int max(int arr[]) {
        int max = arr[0];
        for (int i = 0; i < 5; i++) {
            if (max < arr[i + 1]) {
                max = arr[i + 1];
            }
        }
        return max;
    }
    public static int min(int arr[]) {
        int max = arr[0];
        for (int i = 0; i < 5; i++) {
            if (max > arr[i + 1]) {
                max = arr[i + 1];
            }
        }
        return max;
    }
}
